home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / INFO / PCCDEMO.ZIP / COMP1.EXE / MODEX.PRS < prev    next >
Text File  |  1993-12-20  |  30KB  |  485 lines

  1.                                         êìôæÄâöéôêÄì ôÄ îÄâä ù ╧╧╬╠╬╠╬╠╬╠╬╠╡
  2.                                      
  3.            σΣα≤⌠±Σ α±≤ΦΓδΣ             │  Φ φ π Σ ≈
  4.                                        │
  5.                                        │  Ü. αß≥≤±αΓ≤
  6.                                        │  ¢. Φφ≤±επ⌠Γ≤Φεφ  ≤ε ≤τΣ ⌡µα
  7.                                        │     αφπ Φ≤≥  £ƒá-Γεδε±  ∞επΣ
  8.                                        │  £. µΣ≤≤Φφµ  ∞ε±Σ  ∩αµΣ≥ αφπ 
  9.                                        │     ∩⌠≤≤Φφµ √ε⌠± σΦ±≥≤ ∩Φ≈Σδ
  10. ▄██████▄─██████─█████▄─▄█████─██─┐ ██─┐│  ¥. ≤τΣ ±εαπ σ±ε∞ τΣ±Σ
  11. ██ ┌█ ┌█ ██ ┌██ ██ ┌██ ██▄▄▄──┘██└██ ┌┘│  ₧. ßεεΩ≥ εφ ≤τΣ ≥⌠ßΘΣΓ≤
  12. ██ │█ │█ ██ │██ ██ │██ ██▀▀▀   ▄███▄ │ │  ƒ. ß√Σ - σε± φε÷
  13. ██ │█ │█ ██████ █████  ██████─██▀┌▀██└┐│
  14.  └─┘└─┘└─┘└─────┘└─────┘└─────┘└─┘  └─┘│  
  15.                                        │  σ Φ µ ⌠ ± Σ ≥:
  16.          ß√ ±εßΣ±≤ ≥Γτ∞Φπ≤             │  σ¢:
  17.                                        │  memory organization in mode 13h
  18.                                        │
  19.   Γ  ≥ ε ⌠ ± Γ Σ:   ∞επΣ≈δΦß.Γ         │  σ£:
  20.   v1.1  -  simple  graphics library    │  memory organization  in unchained
  21.   for  planar,  256-color  modes  -    │  modes
  22.   optionally self-testing.             │
  23.                                        
  24.  
  25. Ü. αß≥≤±αΓ≤                          │   understanding    of   hexadecimal
  26.                                      │   notation  and   the  concepts  of
  27.    This  text   gives   a  fairly    │   segments   and   I/O   ports   is
  28. basic, yet technical, explanation    │   assumed.   Keep  a  VGA reference
  29. to what, why and how Mode X is.      │   handy, which at least should have
  30.    It first tries  to explain the    │   definitions of  the VGA registers
  31. layout of the  VGA memory and the    │   at bit level.
  32. shortcomings   of   the  standard    │
  33. 320x200   256-color   mode,  then    │      Throughout   the   article,  a
  34. gives instructions on how one can    │   simple   graphics   library   for
  35. progress  from  mode   13h  to  a    │   unchained    (planar)   256-color
  36. multipage,  planar  320x200  256-    │   modes is developed.   The library
  37. color mode, and from there to the    │   supports the  320x200 and 320x240
  38. quasi-standard    320x240   mode,    │   modes, active  and visible pages,
  39. known as Mode X.                     │   and    writing     and    reading
  40.                                      │   individual pixels.
  41.    A    little    experience   in    │
  42. programming the standard VGA mode    │
  43. 13h (320x200  in  256  colors) is    │   ¢. Φφ≤±επ⌠Γ≤Φεφ  ≤ε  ≤τΣ  ⌡µα αφπ
  44. assumed.      Likewise   a   good    │   Φ≤≥ £ƒá-Γεδε± ∞επΣ
  45.  
  46.  
  47.                                      │   known mode  13h.   This  mode has
  48.    Since its  first appearance on    │   one good and one  bad asset.  The
  49. the motherboards of  the IBM PS/2    │   good one  is  that each  pixel is
  50. 50, 60 and 80 models in 1987, the    │   easily addressable  in  the video
  51. Video Graphics Array has been the    │   memory segment at 0A000h.  Simply
  52. de   facto   standard   piece  of    │   calculate the  offset  using this
  53. graphics  hardware  for  IBM  and    │   formula:
  54. compatible personal computers.       │
  55.    The abbreviation,  VGA, was to    │   offset = (y * 320) + x;
  56. most   people   synonymous   with    │
  57. acceptable   resolution  (640x480    │      Set the  byte at  this address
  58. pixels), and  a  stunning rainbow    │   (0A000h:offset) to  the color you
  59. of colors (256  from a palette of    │   want,  and  the  pixel  is there.
  60. 262,144),  at  least  compared to    │   Reading  a   pixel  is   just  as
  61. the  rather  gory   CGA  and  EGA    │   simple: just  read a  byte.  This
  62. cards.                               │   was heaven, compared  to the hell
  63.                                      │   of planes  and  masking registers
  64.    Sadly, to use  256 colors, the    │   needed in 16-color modes.
  65. VGA  BIOS  limited  the  users to    │      Suddenly, the  distance from a
  66. 320x200  pixels,  i.e.  the well-    │   graphics algorithm on paper to an
  67.  
  68.  
  69. implemented graphics  routine was    │
  70. cut  down  to  a  fraction.   The    │      Now,  the  alert  reader might
  71. results  were  impressively  fast    │   say: "Hold on a  minute!  If mode
  72. too!                                 │   13h enables  only one  page, this
  73.                                      │   means that  there  is  memory for
  74.    The bad asset is that mode 13h    │   only one page.   But I know for a
  75. is also limited to only one page,    │   fact that all  VGAs have at least
  76. i.e. the  VGA  can only  hold one    │   256 Kb RAM,  and one 320x200 256-
  77. screenful at any  one time.  Most    │   color  page  should  consume only
  78. 16-color modes  let the  VGA hold    │   320*200=64000  bytes,   which  is
  79. more  than  one  page,  and  this    │   less than 64 Kb.   A standard VGA
  80. enables you  to  show one  of the    │   should room  a  little  more than
  81. pages to the  user, while drawing    │   four  320x200   pages!"     Quite
  82. on another page in the meantime.     │   correct, and to  see how the BIOS
  83.    Page flipping  is an important    │   puts this limitation on mode 13h,
  84. concept  in  making  flicker free    │   I'll elaborate  a  little  on the
  85. animations.    Nice  looking  and    │   memory organization of the VGA.
  86. smooth scrolling  is  also almost    │
  87. impossible  in  this  mode  using    │      The memory  is  separated into
  88. plain VGA hardware.                  │   four bit planes.   The reason for
  89.  
  90.  
  91. this stems  from  the  EGA, where    │   since each  address in  the video
  92. graphics modes were 16-color.        │   segment can access  8 pixels, and
  93.    Using    bit    planes,    the    │   there are  64  Kb addresses,  8 *
  94. designers chose to let each pixel    │   65,536 =  524,288 16-color pixels
  95. on  screen  be  addressable  by a    │   can be  accessed.   In  a 320x200
  96. single bit  in  a single  byte in    │   16-color  mode,  this  makes  for
  97. the video segment.   Assuming the    │   about    8    (524,288/(320*200))
  98. palette  has  not  been  modified    │   pages, in 640x480  you get nearly
  99. from  the   default,  each  plane    │   2 (524,288/(640*480)) pages.
  100. represent one of  the EGA primary    │
  101. colors:  red,   green,  blue  and    │      In  a   256-color   mode,  the
  102. intensity.                           │   picture  changes   subtly.    The
  103.    When    modifying    the   bit    │   designers  decided   to  fix  the
  104. representing a  pixel,  the Write    │   number of  bit  planes  to  4, so
  105. Plane Enable  register is  set to    │   extending the  logic  above  to 8
  106. the  wanted  color.    Reading is    │   planes and  256  colors  does not
  107. more  complex  and  slower, since    │   work.    Instead,  one  of  their
  108. you can  only read  from a single    │   goals was  to make  the 256-color
  109. plane at  a time,  by setting the    │   mode  as   easily  accessible  as
  110. Read Plane Select register.  Now,    │   possible.      Comparing   the  8
  111.  
  112.  
  113. pixels/address in  16-color modes    │   selected bitplane, press F1 for a
  114. to the  1-to-1  correspondence of    │   graphical representation.
  115. pixels and addresses of mode 13h,    │      Reading works exactly the same
  116. one  can   say  that   they  have    │   way.  Since the bit planes are so
  117. succeeded, but at a certain cost.    │   closely tied to the address, only
  118. For reasons  I  am not  aware of,    │   every fourth  byte  in  the video
  119. the designers  came  up  with the    │   memory is accessible,  and 192 Kb
  120. following effective,  but memory-    │   of a  256  Kb  VGA  go  to waste.
  121. wasting scheme:                      │   Eliminating  the  need  to bother
  122.                                      │   about     planes      sure     is
  123.    The address space  of mode 13h    │   convenientand beneficial,  but in
  124. is divided evenly across the four    │   most people's opinion the loss of
  125. bit planes.   When an 8-bit color    │   3/4 of VGA memory is too much.
  126. value  is  written  to  a  16-bit    │
  127. address in the VGA segment, a bit    │      To accomodate  this new method
  128. plane  is  automatically selected    │   of  accessing  video  memory, the
  129. by the  2 least  significant bits    │   VGA  designers  introduced  a new
  130. of the address.   Then all 8 bits    │   configuration bit called Chain-4,
  131. of the  data  is  written  to the    │   which resides as  bit number 3 in
  132. byte at the 16-bit address in the    │   index 4 of the Sequencer.  In 16-
  133.  
  134.  
  135. color  modes,  the  default state    │   won't bother about these for now.
  136. for this  bit is  off (zero), and    │
  137. the  VGA  operates  as  described    │   £. µΣ≤≤Φφµ ∞ε±Σ ∩αµΣ≥ αφπ ∩⌠≤≤Φφµ
  138. earlier.   In the  VGA's standard    │   √ε⌠± σΦ±≥≤ ∩Φ≈Σδ
  139. 256-color  mode,  mode  13h, this    │
  140. bit is  turned  on (set  to one),    │      The observant  reader might at
  141. and this turns  the tieing of bit    │   this time  suggest  that clearing
  142. planes and memory address on.        │   the  Chain-4  bit  after  setting
  143.                                      │   mode 13h  will give  us access to
  144.    In this state,  the bit planes    │   all 256  Kb  of video  memory, as
  145. are said to be chained together.     │   the two least significant bits of
  146.                                      │   the   byte   address   won't   be
  147.    Note that Chain-4 in itself is    │   `wasted'  on   selecting   a  bit
  148. not  enough  to  set  a 256-color    │   plane.   This  is  correct.   You
  149. mode - there  are other registers    │   might also start feeling a little
  150. which deals with the other subtle    │   uneasy,  because  something tells
  151. changes in nature  from 16 to 256    │   you that  you'll  instantly loose
  152. colors.  But, as we now will base    │   the  simple  addressing  of  mode
  153. our work with mode X on mode 13h,    │   13h.     Sadly,   that   is  also
  154. which  already  is  256-color, we    │   correct.
  155.  
  156.  
  157.                                      │   is  beyond  the   scope  of  this
  158.    At  the   moment   Chain-4  is    │   getting-you-started text,  and it
  159. cleared,    each    byte   offset    │   wouldn't   be   very  interesting
  160. addresses    *four*    sequential    │   anyway.    Here  is  the  minimum
  161. pixels.  Before writing to a byte    │   snippet of code to initiate the 4
  162. offset in the  video segment, you    │   page variant of mode 13h, written
  163. should make  sure that  the 4-bit    │   in  plain   C,  using   some  DOS
  164. mask in  the  Write  Plane Enable    │   specific features (see header for
  165. register   is    set   correctly,    │   a   note    about   the   sources
  166. according to  which  of  the four    │   included):
  167. addressable  pixels  you  want to    │
  168. modify.    In  essence,  it works    │   ----8<-------cut begin------
  169. like  a  16-color   mode  with  a    │
  170. twist.  Press F2 for figure 2.       │   /*   width   and   height  should
  171.                                      │   specify   the   mode  dimensions.
  172.    So,  is  this  mode  X?    Not    │   widthBytes specify the width of a
  173. quite.   We need  to elaborate to    │   line in addressable bytes. */
  174. the VGA  how  to  fetch  data for    │
  175. refreshing  the   monitor  image.    │   int width, height, widthBytes;
  176. Explaining the  logic behind this    │
  177.  
  178.  
  179. /* actStart  specifies  the start    │
  180. of  the  page  being  accessed by    │        /* Set VGA BIOS mode 13h: */
  181. drawing  operations.     visStart    │
  182. specifies  the  contents  of  the    │        r.x.ax = 0x0013;
  183. Screen   Start register, i.e. the    │        int86(0x10, &r, &r);
  184. start of the visible page */         │
  185.                                      │   /* Turn off  the Chain-4 bit (bit
  186. unsigned actStart, visStart;         │   3 at index 4, port 0x3c4): */
  187.                                      │
  188. /*                                   │        outport(SEQU_ADDR, 0x0604);
  189.  * set320x200x256_X()                │
  190.  *      sets mode 13h, then turns    │   /* Turn off word mode, by setting
  191. it into an unchained (planar), 4-    │   the Mode Control register  of the
  192. page    320x200x256 mode.            │   CRT Controller  (index 0x17, port
  193.  */                                  │   0x3d4): */
  194.                                      │
  195. set320x200x256_X()                   │        outport(CRTC_ADDR, 0xE317);
  196.      {                               │
  197.                                      │   /* Turn  off doubleword  mode, by
  198.      union REGS r;                   │   setting  the  Underline  Location
  199.  
  200.  
  201. register   (index    0x14,   port    │
  202. 0x3d4): */                           │        width   = 320;
  203.                                      │        height  = 200;
  204.      outport(CRTC_ADDR, 0x0014);     │
  205.                                      │   /*  Each   byte   addresses  four
  206. /* Clear entire  video memory, by    │   pixels, so  the  width of  a scan
  207. selecting all  four  planes, then    │   line  in *bytes* is one fourth of
  208. writing 0 to  the entire segment.    │   the number  of pixels  on a line.
  209. */                                   │   */
  210.                                      │
  211.      outport(SEQU_ADDR, 0x0F02);     │        widthBytes = width / 4;
  212.      memset(vga+1, 0, 0xffff);       │
  213. /* stupid  size_t  exactly  1 too    │   /*  By  default  we  want  screen
  214. small */                             │   refreshing and drawing operations
  215.      vga[0] = 0;                     │   to be  based at  offset 0  in the
  216.                                      │   video segment. */
  217. /* Update the global variables to    │
  218. reflect   dimensions    of   this    │        actStart = visStart = 0;
  219. mode.   This  is  needed  by most    │
  220. future drawing operations. */        │        }
  221.  
  222.  
  223.                                      │   graphics   operations    by   the
  224. ----8<-------cut end------           │   address of the start of the page,
  225.    As you  can see,  I've already    │   as demonstrated in  the put pixel
  226. provided  some  of  the mechanics    │   routine   below.   Selecting  the
  227. needed to support multiple pages,    │   visual page must  be passed in to
  228. by  providing  the  actStart  and    │   the VGA,  by  setting  the Screen
  229. visStart   variables.   Selecting    │   Start register. Sadly enough, the
  230. pages can be  done in  one of two    │   resolution  of  this  register is
  231. contexts:                            │   limited to  one addressable byte,
  232.                                      │   which   means   four   pixels  in
  233. 1)  selecting  the  visible page,    │   unchained 256-color  modes.  Some
  234. i.e.  which  page  is  visible on    │   trickery  is  needed  for 1-pixel
  235. screen, and                          │   smooth, horizontal scrolling, but
  236.                                      │   I'll  make  that  a  subject  for
  237. 2)  selecting  the  active  page,    │   later.
  238. i.e. which  page  is  accessed by    │      The   setXXXStart()  functions
  239. drawing operations                   │   provided here accept byte offsets
  240.                                      │   as parameters, so they'll work in
  241.    Selecting the  active  page is    │   any  mode.    If  widthBytes  and
  242. just a  matter of  offsetting our    │   height are set correctly, so will
  243.  
  244.  
  245. the setXXXPage() functions.          │   at the top  of the  screen.  This
  246.                                      │   version  won't  look very well in
  247. ----8<-------cut begin------         │   time  critical  situations (games
  248.                                      │   for  instance)  as  the  register
  249. /*                                   │   outputs are not synchronized with
  250.  *  setActiveStart()   tells  our    │   the screen refresh.  This refresh
  251. graphics operations which address    │   might start when the high byte is
  252. in   video   memory   should   be    │   set, but  before the  low byte is
  253. considered the  top  left corner.    │   set,   which   produces   a   bad
  254. */                                   │   flicker. */
  255.                                      │
  256. setActiveStart(unsigned offset)      │   setVisibleStart(unsigned offset)
  257.      {                               │        {
  258.      actStart = offset;              │        visStart = offset;
  259.      }                               │        outport(CRTC_ADDR,    0x0C);
  260.                                      │   /* set high byte */
  261. /*                                   │        outport(CRTC_ADDR+1,
  262.  *  setVisibleStart()  tells  the    │   visStart >> 8);
  263. VGA from which  byte to fetch the    │        outport(CRTC_ADDR,    0x0D);
  264. first pixel when starting refresh    │   /* set low byte */
  265.  
  266.  
  267.      outport(CRTC_ADDR+1,            │   setVisiblePage(int page)
  268. visStart & 0xff);                    │        {
  269.      }                               │   setVisibleStart(page * widthBytes
  270.                                      │   * height);
  271. /*                                   │        }
  272.  *    setXXXPage()    sets    the    │
  273. specified page by multiplying the    │   ----8<-------cut end------
  274. page number with  the size of one    │
  275. page at  the  current resolution,    │      Due to the  use of bit planes,
  276. then handing the resulting offset    │   the graphics routines tend to get
  277. value over  to  the corresponding    │   more complex  than  in  mode 13h,
  278. setXXXStart() function. The first    │   and  your   first  versions  will
  279. page number is 0. */                 │   generally  tend  to  be  a little
  280.                                      │   slower than  mode 13h algorithms.
  281. setActivePage(int page)              │   Here's a  put  pixel  routine for
  282.      {                               │   any unchained  256-color mode (it
  283. setActiveStart(page  * widthBytes    │   assumes that the 'width' variable
  284. * height);                           │   from  the   above  code   is  set
  285.      }                               │   correctly).   Optimizing  is left
  286.                                      │   as  an   exercise  to   you,  the
  287.  
  288.  
  289. reader.   This  will be  the only    │
  290. drawing operation  I'll  cover in    │   /* The  offset of  the pixel into
  291. this article.                        │   the  video  segment  is  offset =
  292.                                      │   (width *  y +  x) /  4, and write
  293. ----8<-------cut begin------         │   the given  color  to the plane we
  294.                                      │   selected above.   Heed the active
  295. putPixel_X(int  x,  int  y,  char    │   page start selection. */
  296. color)                               │
  297.      {                               │   vga[(unsigned)(widthBytes *  y) +
  298.                                      │   (x / 4) + actStart] = color;
  299. /*  Each  address  accesses  four    │
  300. neighboring   pixels,    so   set    │        }
  301. Write Plane  Enable  according to    │
  302. which pixel  we  want  to modify.    │   char getPixel_X(int x, int y)
  303. The plane  is  determined  by the    │        {
  304. two least significant bits of the    │
  305. x-coordinate: */                     │   /* Select the plane from which we
  306.                                      │   must read the pixel color: */
  307.      outportb(0x3c4, 0x02);          │
  308. outportb(0x3c5, 0x01 << (x & 3));    │        outport(GRAC_ADDR, 0x04);
  309.  
  310.  
  311.      outport(GRAC_ADDR+1, x & 3);    │   helps   quadrupling   the  speed,
  312.                                      │   especially      when      drawing
  313.      return                          │   horizontal   lines   and  filling
  314. vga[(unsigned)(widthBytes *  y) +    │   polygons of a constant color.
  315. (x / 4) + actStart];                 │      Also,  most  block  algorithms
  316.                                      │   can be optimized  in various ways
  317.      }                               │   so that they need only a constant
  318.                                      │   number of  OUTs  (typically four)
  319. ----8<-------cut end------           │   to   the   Write   Plane   Enable
  320.                                      │   register.   OUT  is  a relatively
  321.                                      │   slow instruction.
  322.    However, by now  you should be    │
  323. aware  of  that  the  Write Plane    │      The gained  ability  to access
  324. Enable register  isn't limited to    │   the full  256 Kb  of memory  on a
  325. selecting  just  one  bit  plane,    │   standard VGA  enables  you  to do
  326. like    the    ReadPlane   Select    │   paging   and   all   the  goodies
  327. register is.   You can enable any    │   following   from   that:   smooth
  328. combination  of  all  four  to be    │   scrolling over  large  maps, page
  329. written.  This  ability to access    │   flipping    for    flicker   free
  330. 4  pixels  with  one  instruction    │   animation...   and   I'll   leave
  331.  
  332.  
  333. something     for     your    own    │   to when using that phrase.
  334. imagination.                         │
  335.                                      │      The  good   thing   about  the
  336.    In  short,  the  stuff  gained    │   320x240 mode  is that  the aspect
  337. from  using  mode   X  more  than    │   ratio is  1:1,  which  means that
  338. upweighs      the      additional    │   each   pixels    is   'perfectly'
  339. complexity  of   using  a  planar    │   square, i.e. not rectangular like
  340. mode.                                │   in 320x200. An ellipse drawn with
  341.                                      │   the same  number of  pixels along
  342.    Now,  the  resolution  of  the    │   both main  axes will  look like a
  343. mode  is  of  little  interest in    │   perfect  circle  in  320x240, but
  344. this context.    Nearly  any 256-    │   like  a  subtly  tall  ellipse in
  345. color  resolution   from  (about)    │   320x200.
  346. 80x8 to 400x300  is available for    │
  347. most     VGAs.     I'll     dwell    │      Here's a  function  which sets
  348. particularly by  320x240, as this    │   the 320x240 mode.   You'll notice
  349. is the  mode that  Michael Abrash    │   that  it  depends  on  the  first
  350. introduced as 'Mode X' in his DDJ    │   piece of code above:
  351. articles.   It    is   also   the    │
  352. resolution that most people refer    │   ----8<-------cut begin------
  353.  
  354.  
  355.                                      │   as  possible: */
  356. set320x240x256_X()                   │
  357.      {                               │        outport(0x3D4,      0x2C11);
  358.                                      │   /* turn off write protect */
  359. /* Set  the unchained  version of    │        outport(0x3D4,      0x0D06);
  360. mode 13h: */                         │   /* vertical total */
  361.                                      │        outport(0x3D4,      0x3E07);
  362.      set320x200x256_X();             │   /* overflow register */
  363.                                      │        outport(0x3D4,      0xEA10);
  364. /*  Modify   the   vertical  sync    │   /* vertical retrace start */
  365. polarity bits in the Misc. Output    │        outport(0x3D4,      0xAC11);
  366. Register to achieve square aspect    │   /*  vertical   retrace   end  AND
  367. ratio: */                            │   wr.prot */
  368.                                      │        outport(0x3D4,      0xDF12);
  369.      outportb(0x3C2, 0xE7);          │   /* vertical display enable end */
  370.                                      │        outport(0x3D4,      0xE715);
  371. /*  Modify  the  vertical  timing    │   /* start vertical blanking */
  372. registers    to    reflect    the    │        outport(0x3D4,      0x0616);
  373. increased    vertical resolution,    │   /* end vertical blanking */
  374. and to  center the  image as good    │
  375.  
  376.  
  377. /* Update  mode  info,  so future    │   VGA, but  this  is quite  a large
  378. operations  are   aware   of  the    │   and  complex   subject,  so  I'll
  379. resolution: */                       │   postpone this to later, if ever.
  380.                                      │
  381.      height = 240;                   │      Anyway,  I  hope  I've  helped
  382.                                      │   getting you started using mode X.
  383.      }                               │   As far as  I know,  the two modes
  384.                                      │   I've used  above  should  work on
  385. ----8<-------cut end------           │   *any*   VGA    and    Super   VGA
  386.                                      │   available,  so   this  is  pretty
  387.    As  you've  figured  out, this    │   stable stuff.  Good luck!
  388. mode    will     be    completely    │
  389. compatible   with   the   utility    │   ¥. ≤τΣ ±εαπ σ±ε∞ τΣ±Σ
  390. functions    presented   earlier,    │
  391. thanks  to  the  global  variable    │      I'm  providing  information on
  392. 'height'.                            │   various  libraries  and  archives
  393.                                      │   which relate to what this article
  394.    Other resolutions are achieved    │   deals with.   If  you want  me to
  395. through  giving  other  values to    │   add anything  to  this  list (for
  396. the sync timing  registers of the    │   future  articles),  let  me know,
  397.  
  398.  
  399. although    I    can't    promise    │   graphprg.zip
  400. anything. I am  assuming you have    │
  401. ftp access.                          │      Michael  Abrash'  articles  in
  402.                                      │   Doctor  Dobbs  Journal  is always
  403. netcom.com:/pub/profile/game-        │   mentioned with awe.   In this 350
  404. dev/msdos/xlib04c.zip                │   Kb   archive,    most    of   his
  405.                                      │   interesting   stuff    has   been
  406.    This is  the current  de facto    │   gathered.    Read  about  Mode  X
  407. C/assembler      library      for    │   development  and  techniques from
  408. programming  unchained  modes (do    │   month to month.  Included is also
  409. not  confuse  with  a  X  Windows    │   all  the  individual  source code
  410. library).      All   sources  are    │   snippets from  each  article, and
  411. included,  and   the  library  is    │   also  the   full  XSHARP  library
  412. totally free.   It  has functions    │   providing  linedrawing, polygons,
  413. for   pixels,   lines,   circles,    │   bitmaps, solid  3D projection and
  414. bezier  curves,  mouse  handling,    │   speedy  rendering,  and  even  an
  415. sprites    (bitmaps),    compiled    │   implementation   of   2D  texture
  416. bitmaps, and supports a number of    │   mapping (can be used for quasi-3D
  417. resolutions.                         │   texture mapping), plus an article
  418.                                      │   on assembly  optimization  on the
  419.  
  420.  
  421. i86 processor family.  Definitely    │      might be  of  interest  to the
  422. recommended.                         │   more adventurous  reader.   TWEAK
  423.                                      │   lets  you  play  around  with the
  424. oak.oakland.edu:/pub/msdos/vga/vg    │   registers  of   the  VGA   in  an
  425. adoc2.zip                            │   interactive    manner.    Various
  426.                                      │   testing screens  for viewing your
  427.    This  is  a   bare  bones  VGA    │   newmade modes are  applied at the
  428. register  reference.     It  also    │   press  of  a  key.    Keep  a VGA
  429. contains register  references for    │   reference handy.  Don't try it if
  430. the CGA, EGA  and Hercules cards,    │   this  is  the  first  time you've
  431. in   addition    to   dozens   of    │   heard of 'registers'  or 'mode X'
  432. SuperVGAs.   Check out  the BOOKS    │   or 'tweaking'.
  433. section  for   some   decent  VGA    │      Watch out for a new version of
  434. references  though  -  you  don't    │   TWEAK  using  the  familiar Turbo
  435. want to start  tweaking without a    │   Vision   interface,   due  before
  436. real one.                            │   Christmas 1993!
  437.                                      │
  438. oak.oakland.edu:/pub/msdos/vga/tw    │   ₧. ßεεΩ≥ εφ ≤τΣ ≥⌠ßΘΣΓ≤
  439. eak10.zip                            │
  440.                                      │      Extremely   little   has  been
  441.  
  442.  
  443. published in  written  form about    │   SuperVGAs, which I haven't seen.
  444. using   'Mode   X'-style   modes.    │
  445. Below are some  books which cover    │   o   Michael   Abrash   :   "Power
  446. VGA   programming    at   varying    │   Graphics     Programming"    from
  447. degrees of  technical  level, but    │   QUE/Programmer's         Journal.
  448. the only one to mention unchained    │   Collections  of   (old)  articles
  449. modes  and  Mode  X,  is  Michael    │   from   Programmer's   Journal  on
  450. Abrash'.  I'd get  one of the VGA    │   EGA/VGA,  read  modes  and  write
  451. references first, though.            │   modes,     animation,    tweaking
  452.                                      │   (320x400 and 360x480).  His newer
  453. o  George  Sutty &  Steve Blair :    │   ravings in  DDJ covers  fast 256-
  454. "Advanced  Pogrammer's  Guide  to    │   color  bitmaps, compiled bitmaps,
  455. the   EGA/VGA" from  Brady. A bit    │   polygons,  3D  graphics,  texture
  456. old  perhaps,   but   covers  all    │   mapping  among other stuff.
  457. *standard* EGA/VGA registers, and    │
  458. discusses most BIOS functions and    │    o     Richard     F.    Ferraro:
  459. other  operations.  Contains disk    │   "Programmer's  Guide  to  the EGA
  460. with   C/Pascal/assembler  source    │   and VGA  video    cards including
  461. code.                                │   Super VGA".    I don't  have this
  462.    There's  a   sequel   out  for    │   one,   but   heard   it's   nice.
  463.  
  464.  
  465. Detailed coverage  of all EGA/VGA    │   resolution you want or need.
  466. registers.      The   Super   VGA    │      You will  be kept  updated via
  467. reference makes it attractive.       │   PC COMPLETE.  However,  I thought
  468.                                      │   I'd let  this  article  go first,
  469.   o     Richard      Wilton     :    │   and see if I get any reaction. If
  470. "Programmer's Guide to  PC & PS/2    │   I  don't,  I'll  stop.  So please
  471. Video Systems"    Less technical,    │   forward      any     suggestions,
  472. more        application/algorithm    │   criticisms,  bombs  and  beers. I
  473. oriented.   Nice   enough,   even    │   can be contacted via PC COMPLETE.
  474. though it  is a  bit outdated, in    │
  475. that   he   discusses   CGA   and    │      You may  do whatever  you like
  476. Hercules cards  just  as  much as    │   with the source  code supplied in
  477. EGA/VGA.                             │   LIB.C. Just don't claim it's your
  478.                                      │   work, or make money on it without
  479. ƒ. ß√Σ - σε± φε÷                     │   doing some work yourself.  Please
  480.                                      │   only  distribute  ∞επΣ≈δΦß.Γ with
  481.    I  am  considering  writing an    │   PC COMPLETE ñ
  482. article text  describing  in more    │
  483. detail  the    process  of  using    │
  484. TWEAK   to    achieve   the   VGA    │
  485.